package com.ruoyi.web.controller.newTable;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.system.domain.TEntryUnit;
import com.ruoyi.system.service.ITEntryUnitService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 毕业生签约单位类型分布Controller
 * 
 * @author ruoyi
 * @date 2024-12-06
 */
@RestController
@RequestMapping("/system/unit")
public class TEntryUnitController extends BaseController
{
    @Autowired
    private ITEntryUnitService tEntryUnitService;

    /**
     * 查询毕业生签约单位类型分布列表
     */
    @PreAuthorize("@ss.hasPermi('system:unit:list')")
    @GetMapping("/list")
    public TableDataInfo list(TEntryUnit tEntryUnit)
    {
        startPage();
        List<TEntryUnit> list = tEntryUnitService.selectTEntryUnitList(tEntryUnit);
        return getDataTable(list);
    }

    /**
     * 导出毕业生签约单位类型分布列表
     */
    @PreAuthorize("@ss.hasPermi('system:unit:export')")
    @Log(title = "毕业生签约单位类型分布", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, TEntryUnit tEntryUnit)
    {
        List<TEntryUnit> list = tEntryUnitService.selectTEntryUnitList(tEntryUnit);
        ExcelUtil<TEntryUnit> util = new ExcelUtil<TEntryUnit>(TEntryUnit.class);
        util.exportExcel(response, list, "毕业生签约单位类型分布数据");
    }

    /**
     * 获取毕业生签约单位类型分布详细信息
     */
    @PreAuthorize("@ss.hasPermi('system:unit:query')")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(tEntryUnitService.selectTEntryUnitById(id));
    }

    /**
     * 新增毕业生签约单位类型分布
     */
    @PreAuthorize("@ss.hasPermi('system:unit:add')")
    @Log(title = "毕业生签约单位类型分布", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody TEntryUnit tEntryUnit)
    {
        return toAjax(tEntryUnitService.insertTEntryUnit(tEntryUnit));
    }

    /**
     * 修改毕业生签约单位类型分布
     */
    @PreAuthorize("@ss.hasPermi('system:unit:edit')")
    @Log(title = "毕业生签约单位类型分布", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody TEntryUnit tEntryUnit)
    {
        return toAjax(tEntryUnitService.updateTEntryUnit(tEntryUnit));
    }

    /**
     * 删除毕业生签约单位类型分布
     */
    @PreAuthorize("@ss.hasPermi('system:unit:remove')")
    @Log(title = "毕业生签约单位类型分布", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(tEntryUnitService.deleteTEntryUnitByIds(ids));
    }
}
